//
//  BindSuccessViewController.m
//  DoorBell
//
//  Created by Eques-imac on 2017/6/28.
//  Copyright © 2017年 Eques-imac. All rights reserved.
//

#import "BindSuccessViewController.h"
@interface BindSuccessViewController ()
@end

@implementation BindSuccessViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor colorWithRed:166/255.0 green:139/255.0 blue:105/255.0 alpha:1.0];
    self.successnewImageView.image = [UIImage imageNamed:@"done@3x.png"];
    self.successnewLabel.text= NSLocalizedString(@"绑定成功", nil) ;
    self.successnewLabel.textColor = [HexChangeRGB colorWithHexString:@"#ffffff"];
   [self.MyDeviceBtn setTitle:NSLocalizedString(@"查看我的设备", nil) forState:UIControlStateNormal];
    self.MyDeviceBtn.backgroundColor =[HexChangeRGB colorWithHexString:@"#ffffff"];
   [self.MyDeviceBtn setTitleColor:[HexChangeRGB colorWithHexString:@"#414141"] forState:UIControlStateNormal];
   [self.cancleBtn setImage:[UIImage imageNamed:@"close@3x.png"] forState:UIControlStateNormal];
   
}

- (void)BindSuccessDissmiss
{
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
}


- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];   
    self.successnewLabel.text = NSLocalizedString(@"绑定成功", nil);
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(UIImageView*)successnewImageView
{
    if (!_successnewImageView) {
         _successnewImageView = [[UIImageView alloc]init];
        [self.view addSubview:_successnewImageView];
        [_successnewImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(300);
            make.width.mas_equalTo(300);
            make.top.equalTo(self.view.mas_top).offset(30+64);
            make.centerX.mas_equalTo(self.view.mas_centerX);
        }];
    }
    return _successnewImageView;
}

-(UILabel*)successnewLabel
{
    if (!_successnewLabel) {
         _successnewLabel =[[UILabel alloc]init];
         _successnewLabel.textAlignment = NSTextAlignmentCenter;
         _successnewLabel.font = [UIFont fontWithName:@"PingFangSC-Medium" size:20.0];
         _successnewLabel.numberOfLines = 0;
        [_successnewLabel sizeToFit];
        [self.view addSubview:_successnewLabel];
        [_successnewLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.top.equalTo(self.successnewImageView.mas_bottom).offset(20);
            make.width.mas_equalTo(260);
            make.centerX.equalTo(self.view.mas_centerX);
           
        }];
    }
    return _successnewLabel;
    
}


-(UIButton*)MyDeviceBtn
{
    if (!_MyDeviceBtn) {
         _MyDeviceBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_MyDeviceBtn addTarget:self action:@selector(seeMyDeviceBtnClick) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:_MyDeviceBtn];
        [_MyDeviceBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view.mas_bottom).offset(-117);
            make.height.mas_equalTo(44);
            make.width.mas_equalTo(260);
            make.centerX.equalTo(self.view.mas_centerX);
        }];
    }
    return _MyDeviceBtn;
}

-(UIButton*)cancleBtn
{
    if (!_cancleBtn) {
         _cancleBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_cancleBtn addTarget:self action:@selector(cancleclick) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:_cancleBtn];
        [_cancleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.view.mas_top).offset(24+20);
            make.height.mas_equalTo(46);
            make.width.mas_equalTo(46);
            make.left.equalTo(self.view.mas_left).offset(14);
        }];
    }
    return _cancleBtn;
}

- (void)cancleclick{
    
    if (self.delegate) {
        if ([self.delegate respondsToSelector:@selector(didSeenewMydeviceBtnClick)]){
            [self.delegate didSeenewMydeviceBtnClick];
        }
    }
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
}

- (void)seeMyDeviceBtnClick
{
    if (self.delegate) {
        if ([self.delegate respondsToSelector:@selector(didSeenewMydeviceBtnClick)]){
            [self.delegate didSeenewMydeviceBtnClick];
        }
    }
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
}

-(void)setOptionstr:(NSString *)optionstr
{
    _optionstr = optionstr;
    self.successnewLabel.text =NSLocalizedString(@"绑定成功", nil);
}
- (BOOL)shouldAutorotate
{
    return NO;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait; // 竖屏
}



@end
